package com.bt.lms.ui.page.info;

import com.bt.lms.ui.action.teacher.basic.info.CheckTeacherBasicDetailBtn;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;

/**
 * 查看教师基本详情界面
 */
public class PageCheckTeacherBasicDetail extends VBox {
    private Integer width=1280;
    private Integer height=900;

    public PageCheckTeacherBasicDetail(){
        this.setPrefWidth(width);
        this.setPrefHeight(height);

        //当前位置
        HBox locationHBox = new HBox();
        locationHBox.setPadding(new Insets(15,15,15,15));
        locationHBox.setPrefWidth(width);
        double locationHBoxHeight=height*0.05;
        locationHBox.setPrefHeight(locationHBoxHeight);
        Label label1 = new Label("当前位置：🏠>教学管理>教师管理>查看教师基本信息详情");
        Font font = Font.font("仿宋", FontWeight.THIN, FontPosture.REGULAR,18);
        label1.setFont(font);
        locationHBox.getChildren().add(label1);
        this.getChildren().add(locationHBox);

        //数据大盒子
        VBox totalVBox = new VBox();
        totalVBox.setPadding(new Insets(15,15,15,15));
        double totalVBoxHeight=height*0.9;
        totalVBox.setPrefHeight(totalVBoxHeight);
        totalVBox.setPrefWidth(width);
        ScrollPane scrollPane = new ScrollPane();//滚动条
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);//只能竖向滚动不能横向滚动
        scrollPane.setContent(totalVBox);
        this.getChildren().add(scrollPane);


        initTeacherInfo(totalVBox);//教师基本信息
        initSaveCancelBtn(totalVBox);//保存/取消按钮


    }


    /**
     * 教师基本信息
     * @param totalVBox 大盒子
     */
    public void initTeacherInfo(VBox totalVBox){

        //教师基本信息数据大盒子
        VBox dataVBox = new VBox();
        dataVBox.setPadding(new Insets(15,15,15,15));
        double dataHBoxHeight=height*0.2;
        dataVBox.setPrefHeight(dataHBoxHeight);
        dataVBox.setPrefWidth(width);
        totalVBox.getChildren().add(dataVBox);
        //教师基本信息标题
        HBox topHBox = new HBox();
        topHBox.setPadding(new Insets(15,15,15,15));
        double topHBoxHeight=height*0.01;
        topHBox.setMaxHeight(topHBoxHeight);
        topHBox.setPrefWidth(width);
        topHBox.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY,null,null)));
        Label addLb = new Label("教师基本信息");
        Font font1 = Font.font("仿宋", FontWeight.BOLD, FontPosture.REGULAR, 20);
        Color color = Color.rgb(12, 12, 12, 1);
        addLb.setFont(font1);
        addLb.setTextFill(color);
        topHBox.getChildren().add(addLb);
        dataVBox.getChildren().add(topHBox);

        //教师基本信息数据盒子
        HBox teacherInfoHBox = new HBox();
        teacherInfoHBox.setPadding(new Insets(15,15,15,15));
        double teacherInfoVBoxHeight=height*0.3;
        teacherInfoHBox.setMaxHeight(teacherInfoVBoxHeight);
        teacherInfoHBox.setPrefWidth(width);
        dataVBox.getChildren().add(teacherInfoHBox);
        //教师基本信息左数据盒子
        VBox teacherInfoLeftVBox = new VBox();
        teacherInfoLeftVBox.setSpacing(20);
        teacherInfoLeftVBox.setPadding(new Insets(15,15,15,15));
        double teacherInfoLeftVBoxHeight=height*0.3;
        teacherInfoLeftVBox.setMaxHeight(teacherInfoLeftVBoxHeight);
        teacherInfoLeftVBox.setPrefWidth(width*0.5);
        teacherInfoHBox.getChildren().add(teacherInfoLeftVBox);

        //教师基本信息右数据盒子
        VBox teacherInfoRightVBox = new VBox();
        teacherInfoRightVBox.setSpacing(20);
        teacherInfoRightVBox.setPadding(new Insets(15,15,15,15));
        double teacherInfoRightVBoxHeight=height*0.3;
        teacherInfoRightVBox.setMaxHeight(teacherInfoRightVBoxHeight);
        teacherInfoRightVBox.setPrefWidth(width*0.5);
        teacherInfoHBox.getChildren().add(teacherInfoRightVBox);

        //账号盒子
        HBox accountHBox = new HBox();
        accountHBox.setSpacing(20);
        double accountHBoxHeight=height*0.05;
        accountHBox.setPrefHeight(accountHBoxHeight);
        accountHBox.setPrefWidth(width);
        Label accountLb = new Label("账号");
        accountLb.setPrefWidth(100);
        Label accountDataLb = new Label("Luxiaoqi@126.com");
        accountHBox.getChildren().addAll(accountLb,accountDataLb);
        //证件类型盒子
        HBox certificateHBox = new HBox();
        certificateHBox.setSpacing(20);
        double certificateHBoxHeight=height*0.05;
        certificateHBox.setPrefHeight(certificateHBoxHeight);
        certificateHBox.setPrefWidth(width);
        Label certificateLb = new Label("证件类型");
        certificateLb.setPrefWidth(100);
        Label certificateDataLb = new Label("身份证");
        certificateHBox.getChildren().addAll(certificateLb,certificateDataLb);
        //性别盒子
        HBox genderHBox = new HBox();
        genderHBox.setSpacing(20);
        double genderHBoxHeight=height*0.05;
        genderHBox.setPrefHeight(genderHBoxHeight);
        genderHBox.setPrefWidth(width);
        Label genderLb = new Label("性别");
        genderLb.setPrefWidth(100);
        Label genderDataLb = new Label("男");
        genderHBox.getChildren().addAll(genderLb,genderDataLb);
        //籍贯盒子
        HBox birthplaceHBox = new HBox();
        birthplaceHBox.setSpacing(20);
        double birthplaceHBoxHeight=height*0.05;
        birthplaceHBox.setPrefHeight(birthplaceHBoxHeight);
        birthplaceHBox.setPrefWidth(width);
        Label birthplaceLb = new Label("籍贯");
        birthplaceLb.setPrefWidth(100);
        Label birthplaceDataLb = new Label("XXXXXXXXX");
        birthplaceHBox.getChildren().addAll(birthplaceLb,birthplaceDataLb);
        //政治面貌盒子
        HBox politicsStatusHBox = new HBox();
        politicsStatusHBox.setSpacing(20);
        double politicsStatusHBoxHeight=height*0.05;
        politicsStatusHBox.setPrefHeight(politicsStatusHBoxHeight);
        politicsStatusHBox.setPrefWidth(width);
        Label politicsStatusLb = new Label("政治面貌");
        politicsStatusLb.setPrefWidth(100);
        Label politicsStatusDataLb = new Label("群众");
        politicsStatusHBox.getChildren().addAll(politicsStatusLb,politicsStatusDataLb);
        //专业盒子
        HBox specialtyHBox = new HBox();
        specialtyHBox.setSpacing(20);
        double specialtyHBoxHeight=height*0.05;
        specialtyHBox.setPrefHeight(specialtyHBoxHeight);
        specialtyHBox.setPrefWidth(width);
        Label specialtyLb = new Label("专业");
        specialtyLb.setPrefWidth(100);
        Label specialtyDataLb = new Label("Java");
        specialtyHBox.getChildren().addAll(specialtyLb,specialtyDataLb);
        //最高学历盒子
        HBox educationHBox = new HBox();
        educationHBox.setSpacing(20);
        double educationHBoxHeight=height*0.05;
        educationHBox.setPrefHeight(educationHBoxHeight);
        educationHBox.setPrefWidth(width);
        Label educationLb = new Label("最高学历");
        educationLb.setPrefWidth(100);
        Label educationDataLb = new Label("本科");
        educationHBox.getChildren().addAll(educationLb,educationDataLb);
        //移动电话盒子
        HBox movePhoneHBox = new HBox();
        movePhoneHBox.setSpacing(20);
        double movePhoneHBoxHeight=height*0.05;
        movePhoneHBox.setPrefHeight(movePhoneHBoxHeight);
        movePhoneHBox.setPrefWidth(width);
        Label movePhoneLb = new Label("移动电话");
        movePhoneLb.setPrefWidth(100);
        Label movePhoneDataLb = new Label("1111111111111");
        movePhoneHBox.getChildren().addAll(movePhoneLb,movePhoneDataLb);
        teacherInfoLeftVBox.getChildren().addAll(accountHBox,certificateHBox,genderHBox,birthplaceHBox,politicsStatusHBox,specialtyHBox,educationHBox,movePhoneHBox);

        //姓名盒子
        HBox nameHBox = new HBox();
        nameHBox.setSpacing(20);
        double nameHBoxHeight=height*0.05;
        nameHBox.setPrefHeight(nameHBoxHeight);
        nameHBox.setPrefWidth(width);
        Label nameLb = new Label("姓名");
        nameLb.setPrefWidth(100);
        Label nameDataLb = new Label("张三");
        nameHBox.getChildren().addAll(nameLb,nameDataLb);
        //证件号码盒子
        HBox certificateNumberHBox = new HBox();
        certificateNumberHBox.setSpacing(20);
        double certificateNumberHBoxHeight=height*0.05;
        certificateNumberHBox.setPrefHeight(certificateNumberHBoxHeight);
        certificateNumberHBox.setPrefWidth(width);
        Label certificateNumberLb = new Label("证件号码");
        certificateNumberLb.setPrefWidth(100);
        Label certificateNumberDataLb= new Label("130703198809890981");
        certificateNumberHBox.getChildren().addAll(certificateNumberLb,certificateNumberDataLb);
        //出生日期盒子
        HBox birthdateHBox = new HBox();
        birthdateHBox.setSpacing(20);
        double birthdateHBoxHeight=height*0.05;
        birthdateHBox.setPrefHeight(birthdateHBoxHeight);
        birthdateHBox.setPrefWidth(width);
        Label birthdateLb = new Label("出生日期");
        birthdateLb.setPrefWidth(100);
        Label birthdateDataLb= new Label("2003.05.08");
        birthdateHBox.getChildren().addAll(birthdateLb,birthdateDataLb);
        //民族盒子
        HBox nationHBox = new HBox();
        nationHBox.setSpacing(20);
        double nationHBoxHeight=height*0.05;
        nationHBox.setPrefHeight(nationHBoxHeight);
        nationHBox.setPrefWidth(width);
        Label nationLb = new Label("民族");
        nationLb.setPrefWidth(100);
        Label nationDataLb= new Label("汉");
        nationHBox.getChildren().addAll(nationLb,nationDataLb);
        //所属单位盒子
        HBox unitHBox = new HBox();
        unitHBox.setSpacing(20);
        double unitHBoxHeight=height*0.05;
        unitHBox.setPrefHeight(unitHBoxHeight);
        unitHBox.setPrefWidth(width);
        Label unitLb = new Label("所属单位");
        unitLb.setPrefWidth(100);
        Label unitDataLb = new Label("xxxxxxx");
        unitHBox.getChildren().addAll(unitLb,unitDataLb);
        //职称盒子
        HBox rankHBox = new HBox();
        rankHBox.setSpacing(20);
        double rankHBoxHeight=height*0.05;
        rankHBox.setPrefHeight(rankHBoxHeight);
        rankHBox.setPrefWidth(width);
        Label rankLb = new Label("职称");
        rankLb.setPrefWidth(100);
        Label rankDataLb = new Label("xxxxxxx");
        rankHBox.getChildren().addAll(rankLb,rankDataLb);
        //教龄盒子
        HBox seniorityHBox = new HBox();
        seniorityHBox.setSpacing(20);
        double seniorityHBoxHeight=height*0.05;
        seniorityHBox.setPrefHeight(seniorityHBoxHeight);
        seniorityHBox.setPrefWidth(width);
        Label seniorityLb = new Label("教龄");
        seniorityLb.setPrefWidth(100);
        Label seniorityDataLb = new Label("1");
        seniorityHBox.getChildren().addAll(seniorityLb,seniorityDataLb);
        //电话盒子
        HBox phoneHBox = new HBox();
        phoneHBox.setSpacing(20);
        double phoneHBoxHeight=height*0.05;
        phoneHBox.setPrefHeight(phoneHBoxHeight);
        phoneHBox.setPrefWidth(width);
        Label phoneLb = new Label("联系电话");
        phoneLb.setPrefWidth(100);
        Label phoneDataLb = new Label("1122162561552");
        phoneHBox.getChildren().addAll(phoneLb,phoneDataLb);
        teacherInfoRightVBox.getChildren().addAll(nameHBox,certificateNumberHBox,birthdateHBox,nationHBox,unitHBox,rankHBox,seniorityHBox,phoneHBox);


        //研究方向盒子
        HBox outcomeHBox = new HBox();
        outcomeHBox.setSpacing(20);
        outcomeHBox.setAlignment(Pos.CENTER_LEFT);
        outcomeHBox.setPadding(new Insets(0,0,0,30));
        double outcomeHBoxHeight=height*0.1;
        outcomeHBox.setPrefHeight(outcomeHBoxHeight);
        outcomeHBox.setPrefWidth(width);
        Label outcomeLb = new Label("研究方向及成果");
        outcomeLb.setPrefWidth(100);
        Label outcomeDataLb = new Label("fgeuwdhiwqhduchuhdfjidedjnmcjenvnoi9feijxoio");
        outcomeHBox.getChildren().addAll(outcomeLb,outcomeDataLb);
        dataVBox.getChildren().add(outcomeHBox);

        //照片盒子
        HBox pictureHBox = new HBox();
        pictureHBox.setAlignment(Pos.CENTER_LEFT);
        pictureHBox.setPadding(new Insets(20,0,0,30));
        pictureHBox.setSpacing(20);
        double pictureHBoxHeight=height*0.1;
        pictureHBox.setPrefHeight(pictureHBoxHeight);
        pictureHBox.setPrefWidth(width);
        Label pictureLb = new Label("照片");
        pictureLb.setPrefWidth(100);
        //获取头像图片路径
        String url = "https://img2.woyaogexing.com/2023/05/05/03de935e190f149c137414263b79982a.jpg";
        Image image = new Image(url);
        ImageView imageView = new ImageView(image);
        imageView.setFitWidth(150);
        imageView.setFitHeight(150);
        pictureHBox.getChildren().addAll(pictureLb,imageView);
        dataVBox.getChildren().add(pictureHBox);


    }

    /**
     * 取消按钮
     * @param totalVBox 大盒子
     */
    public void initSaveCancelBtn(VBox totalVBox) {

        //返回按钮盒子
        HBox addHBox = new HBox();
        addHBox.setAlignment(Pos.CENTER);
        addHBox.setPadding(new Insets(20,0,0,30));
        addHBox.setSpacing(20);
        double addHBoxHeight=height*0.1;
        addHBox.setPrefHeight(addHBoxHeight);
        addHBox.setPrefWidth(width);
        Button returnBtn = new Button("返回");
        returnBtn.setStyle("-fx-background-color: #43c74a");
        addHBox.getChildren().add(returnBtn);
        this.getChildren().add(addHBox);

        //返回教师基本信息列表事件
        CheckTeacherBasicDetailBtn checkTeacherBasicDetailBtn = new CheckTeacherBasicDetailBtn();
        returnBtn.setOnAction(checkTeacherBasicDetailBtn);


    }




















}
